using NewFormatProject.Infrastructure.EFCore;
using NewFormatProject.Infrastructure.Dto.Responses.Objects;
using NewFormatProject.Server.EFCore;
using System.Linq;
namespace NewFormatProject.Server.Instances.Extends.Entitys
{
	public static class JobsExtend
{
		public static ResponseJobsDto ToResponseDto(this Jobs entity)
{			return new ResponseJobsDto
			{
				id = entity.JId,
				name = entity.JName,
				description = entity.JDescription,
				departmentId = entity.JDepartmentId,
				createTime = entity.JCreateTime,
				departmentName=new DepartmentServerEF(new Core2Context()).Query(d=>d.DId==entity.JDepartmentId).Select(d=>d.DName).SingleOrDefault()

            };
		}
	}
}
